clear
rng default
load IdSetW_final_1
IdSetW{1}=IdSetW_final_1;
load IdSetW_final_2
IdSetW{2}=IdSetW_final_2;
load IdSetW_final_3
IdSetW{3}=IdSetW_final_3; 
load IdSetW_final_4
IdSetW{4}=IdSetW_final_4;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in one dimension %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ntypes_w=4;
V_1=cell(ntypes_w,1);
V_2=cell(ntypes_w,1);
V_3=cell(ntypes_w,1);
V_4=cell(ntypes_w,1);
for y=1:ntypes_w
    V_1{y}=[min(IdSetW{y}(:,2)); max(IdSetW{y}(:,2))];
    V_2{y}=[min(IdSetW{y}(:,3)); max(IdSetW{y}(:,3))];
    V_3{y}=[min(IdSetW{y}(:,4)); max(IdSetW{y}(:,4))];
    V_4{y}=[min(IdSetW{y}(:,5)); max(IdSetW{y}(:,5))];
end

save('V_intervals.mat', 'V_1', 'V_2', 'V_3', 'V_4')

clearvars -except IdSetW ntypes_w

 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in two dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load V_CS
for y=1:ntypes_w
    %v2y v3y
    M=unique([IdSetW{y}(:,3) IdSetW{y}(:,4)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(2,y), V_CS(3,y), 60,'r', 'filled')
    xlabel(sprintf('V_{2%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{3%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_2%d_3%d.jpg',y,y))
    
    %v2y v4y
    M=unique([IdSetW{y}(:,3) IdSetW{y}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(2,y), V_CS(4,y), 60,'r', 'filled')
    xlabel(sprintf('V_{2%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{4%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_2%d_4%d.jpg',y,y))
    
    
    %v3y v4y
    M=unique([IdSetW{y}(:,4) IdSetW{y}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(3,y), V_CS(4,y), 60,'r', 'filled')
    xlabel(sprintf('V_{3%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{4%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_3%d_4%d.jpg',y,y))
    

end


close all





